package com.gxa.saas.pojo;


import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class VisitResult implements Serializable {

    private Integer id;
    private String name;
    private String contactPerson;
    private String visitType;
    private Integer signDistance;
    @JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss",timezone = "GMT+8")
    private Date inplaceTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss",timezone = "GMT+8")
    private Date outplaceTime;
    private Long stayplaceTime;


    public void setStayplaceTime(){
        if(inplaceTime!=null && outplaceTime!=null && "".equals(inplaceTime) &&"".equals(outplaceTime) ){
            long time = outplaceTime.getTime();
            long time1 = inplaceTime.getTime();
            Date date = new Date(time - time1);
            this.stayplaceTime=(time-time1)/3600000;
        }else{
            this.stayplaceTime=(long)0;
        }
    }

}
